package cn.gintone.mybatis.springboot;

import java.util.List;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import cn.gintone.mybatis.mapper.CountryMapper;
import cn.gintone.mybatis.model.Country;

@SpringBootApplication
@MapperScan({"cn.gintone.mybatis.mapper","cn.gintone.mybatis.springboot.mapper"})
public class Chapter03Application implements CommandLineRunner{
	@Autowired
	private CountryMapper countryMapper;
	public static void main(String[] args) {
		SpringApplication.run(Chapter03Application.class, args);
	}
	@Override
	public void run(String... args) throws Exception{
		List<Country> countryList = countryMapper.selectAll();
		for (Country country : countryList) {
			System.out.println(country.getCountryname());
		}
	}
}
